<template>
  <div class="wrapper">
    <app-dialog></app-dialog>
    <app-header></app-header>
    <app-sidebar></app-sidebar>
    <div class="content-wrapper" :class="{ 'to-full' : isHideSideBar}">
      <app-tab></app-tab>
      <!-- <app-path-nav></app-path-nav> -->
      <div class="router-wrapper">
          <router-view></router-view>
        <!-- </keep-alive> -->
        <!--<router-view v-else></router-view>-->
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import common from '../mixins/common.js'
import Loading from '../components/widgets/Loading.vue'
import Toast from '../components/widgets/Toast.vue'
import Dialog from '../components/widgets/Dialog.vue'
import Header from '../components/Header.vue'
import Sidebar from '../components/Sidebar.vue'
import Tab from '../components/Tab.vue'
// import PathNav from '../components/PathNav.vue'

export default {
  mixins: [ common ],
  data () {
    return {
      isDestory: false,
      isShow: true
    }
  },
  computed: {
    ...mapGetters({
      isHideSideBar: 'getIsHideSideBar'
    })
  },
  components: {
    'app-loading': Loading,
    'app-toast': Toast,
    'app-dialog': Dialog,
    'app-header': Header,
    'app-sidebar': Sidebar,
    'app-tab': Tab
    // 'app-path-nav': PathNav
  },
  created () {
    if(!this.userToken) {
      let _token = sessionStorage.getItem('_t');
      if(_token) {
        this.$store.commit('SET_USERTOKEN', _token);
      }
    }

    // this.judgeIsLogin();
  },
  methods: {
    judgeIsLogin () {
      if(!this.userToken) {
        this.$router.push({
          path: '/login'
        })
      }
    }
  }
}
</script>

<style lang="less">

</style>
